---
title: "Aggregation"
enterprise: true
---
Apply custom or provided functions to values to calculate group values in the grid.

{% gridExampleRunner title="Aggregation Overview" name="aggregation-overview"  exampleHeight=540 /%}

## Enabling Aggregation

Aggregations can be enabled in the grid by setting the `aggFunc` column definition value to one of: `sum`, `min`, `max`, `count`, `avg`, `first`, or `last`.

The following configuration demonstrates how to enable aggregation on a column:
```{% frameworkTransform=true %}
const gridOptions = {
    columnDefs: [
        { field: 'gold', aggFunc: 'sum' },
        { field: 'silver', aggFunc: 'max' },
        { field: 'bronze', aggFunc: 'avg' },
        // ... other column definitions
    ],
}
```

## API Reference

{% note %}
The aggregation state can be saved and restored as part of [Grid State](./grid-state/).
{% /note %}

Aggregations can be configured using the following column properties:

{% apiDocumentation source="column-properties/properties.json" section="aggregation" /%}

Aggregation functions can be registered with the grid using the following grid options:

{% apiDocumentation source="grid-options/properties.json" section="aggregation" /%}

After the grid is initialised aggregations can be applied / retrieved / removed via the `api` with the following methods:

{% apiDocumentation source="grid-api/api.json" section="aggregation" /%}

## Next Up

Continue to the next section to learn how to [Configure Columns](./aggregation-columns/).
